﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_Flow_GetStyleTemplateEx]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_Flow_GetStyleTemplateEx];
GO
CREATE PROCEDURE [dbo].[sproc_Flow_GetStyleTemplateEx]
    @StyleID int,
    @Template nvarchar(300) out
AS
DECLARE @Tmp nvarchar(100)

SET @Tmp =''

IF EXISTS(SELECT 1 FROM uds_flow_style WHERE style_id = @StyleID)
BEGIN
    
    SELECT @Tmp = Template
        FROM uds_flow_style
        WHERE style_id = @StyleID
    
    SET @Template = COALESCE(@Tmp,'')
    SELECT COALESCE(@Tmp,'') AS Template
    IF COALESCE(@Tmp,'') = ''    
    BEGIN        
        PRINT '无模板'
        RETURN 0
    END
    ELSE
    BEGIN
        PRINT '模板名称:'+COALESCE(@Tmp,'')
        RETURN 1
    END
END
ELSE
BEGIN
    SELECT '' AS Template
    PRINT '没有此流程'
    RETURN -1
END